package Astar;



import Astar.AStarHeuristic;
import Astar.TileBasedMap;

/**
 * A heuristic that uses the tile that is closest to the target
 * as the next best tile.
 * 
 * @author Kevin Glass
 */
public class ClosestHeuristics implements AStarHeuristic {
	/**
	 * @see AStarHeuristic#getCost(TileBasedMap, Mover, int, int, int, int)
         * manhattan distance
	 */
	public float getCost(TileBasedMap map, int x, int y, int tx, int ty) {		
		float dx =Math.abs(tx - x);
		float dy = Math.abs(ty - y);
		
		float result = dx+dy;
		return result;
	}


}
